package bTree.LeetCode;

import java.util.Arrays;
import java.util.Collections;

public class 轮转数组 {
    public void rotate(int[] nums, int k) {
        reverse(nums,0, nums.length-1, nums.length);
        reverse(nums,0, k-1,k);
        reverse(nums,k, nums.length-1, nums.length-k);

    }
    public void reverse(int []nums,int start,int end,int len){
        int num=len/2;
        for (int i = 0; i <len; i++) {
            int temp=nums[start+i];
            nums[start+i]=nums[end-i];
            nums[end-i]=temp;
        }
    }
}